package usaco.c2010.january.silver;

import java.util.Scanner;
import java.util.Stack;

/*
 * p3563
 * USACO 2010 January - Silver
 */

public class p3563 {

	static int N, M, Q, ci;
	static int[][] m;
	static int[] com;
	static Stack<Integer> stack;

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		N = scanner.nextInt();
		M = scanner.nextInt();
		Q = scanner.nextInt();
		
		m = new int[N+1][N+1];
		for (int i=1;i<=M;++i) {
			int fr = scanner.nextInt();
			int to = scanner.nextInt();
			m[fr][to] = m[to][fr] = 1;
		}
		com = new int[N+1];
		ci = 1;
		stack = new Stack<Integer>();

		for (int i=1;i<=N;++i) {
			if (com[i] == 0) {
				com[i] = ci;
				stack.push(i);
				// dfs from i
				while (!stack.isEmpty()) {
					int parent = stack.pop();
					for (int j=1;j<=N;++j) {
						if (com[j] == 0) {
							if (m[parent][j] == 1) {
								com[j] = ci;
								stack.push(j);
							}
						}
					}
				}
				// dfs done
				ci++;
			}
		}
		
		for (int i=1;i<=Q;++i) {
			int fr = scanner.nextInt();
			int to = scanner.nextInt();
			if (com[fr] == com[to]) {
				System.out.println("Y");
			}
			else {
				System.out.println("N");
			}
		}
	}

}
